package com.zhoupeisen;

import com.zhoupeisen.dao.OrderDao;
import com.zhoupeisen.dao.UserDao;
import com.zhoupeisen.entity.OrderEntity;
import com.zhoupeisen.entity.UserEntity;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

/**
 * @ClassName test
 * @Description TODO
 * @Author Administrator
 * @Data 下午 03:47
 * @Version 1.0
 **/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = DemoStart.class)
public class test {
    @Autowired
    private UserDao userDao;

    @Test
    public void test1(){
        List<UserEntity> all = userDao.findAll();
        for (UserEntity userEntity : all) {
            System.out.println(userEntity);
        }
    }
    @Test
    public void findById(){
        UserEntity byId = userDao.findById(3);
        System.out.println(byId);
    }
    @Test
    public void findUserAndOrder(){
        List<UserEntity> all = userDao.findUserAndOrder();
        for (UserEntity userEntity : all) {
            System.out.println(userEntity);
        }

    }


}
